package com.suray.type;

/**
 * 6代车导航状态
 */
public enum Rgv60TaskStatus {
    INVALID(-1, "无效"),
    NONE(0, "无任务"),
    WAITING(1, "等待"),
    RUNNING(2, "运行中"),
    SUSPENDED(3, "暂停"),
    COMPLETED(4, "完成"),
    FAILED(5, "导航失败"),
    CANCELED(6, "取消"),
    OVER_TIME(7, "执行超时"),
    NOT_FOUND(404, "未找到"),
    ;

    Integer value;
    String des;
    Rgv60TaskStatus(int value, String des) {
        this.value = value;
        this.des = des;
    }

    public static Rgv60TaskStatus parseStatus(Integer status) {
        if (status == null) {
            return INVALID;
        }

        for (Rgv60TaskStatus taskStatus : Rgv60TaskStatus.values()) {
            if (taskStatus.value.equals(status)) {
                return taskStatus;
            }
        }

        return INVALID;
    }

    public int getValue() {
        return value;
    }

    @Override
    public String toString() {
        return des;
    }
}
